<?php
require '/buscar_registro/Buscar_Empleado.php';

class EliminarEmpleado{

private $empleado;


//__________________INICIAR ELIMININACION________________________________
	public function __construct($id_busqueda,$tipo_de_dato){
		$busqueda = new Buscar_Empleado($id_busqueda, $tipo_de_dato);
		$this->empleado = $busqueda->get_empleado_encontrado();
	}

	public function get_empleado(){
		return $this->empleado;
	}

//__________________CONFIRMAR ELIMINAR________________________________
	public function confirmar(){		
		if(isset($this->empleado)){
		    //mysqli_connect(host,username,password,dbname);
		    $con=mysqli_connect("localhost","root","","base_datos");
		    // Check connection
		    if (mysqli_connect_errno()) {
		    	echo "Failed to connect to MySQL: " . mysqli_connect_error();
		    } else{
		    	$nro_registro= $this->empleado->get_nro_empleado();
				mysqli_query($con,"DELETE FROM empleados WHERE nro_empleado=".$nro_registro." LIMIT 1"); 
		    }
		}
	}
}
?>
